#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    //treeWidget树控件使用

    //设置头
    ui->treeWidget->setHeaderLabels(QStringList()<<"英雄"<<"英雄简介");

    //创建出力量根
    QTreeWidgetItem * liItem = new QTreeWidgetItem(QStringList()<< "力量");
    QTreeWidgetItem * minItem = new QTreeWidgetItem(QStringList()<< "敏捷");
    QTreeWidgetItem * zhiItem = new QTreeWidgetItem(QStringList()<< "智力");
    ui->treeWidget->addTopLevelItem(liItem);
    ui->treeWidget->addTopLevelItem(minItem);
    ui->treeWidget->addTopLevelItem(zhiItem);


    QStringList heroL1;
    heroL1 << "刚被猪" << "前排坦克llll";
    liItem->addChild(new QTreeWidgetItem(heroL1));

    QStringList heroL2;
    heroL2 << "四六" << "前排坦克2222";
    liItem->addChild(new QTreeWidgetItem(heroL2));

    QStringList heroL3;
    heroL3 << "聚少离多" << "前排坦克3333";
    liItem->addChild(new QTreeWidgetItem(heroL3));

    QStringList heroL4;
    heroL4 << "威威" << "前排坦克4444";
    minItem->addChild(new QTreeWidgetItem(heroL4));

    QStringList heroL5;
    heroL5 << "洛杉矶" << "前排坦克5555";
    zhiItem->addChild(new QTreeWidgetItem(heroL5));

}

Widget::~Widget()
{
    delete ui;
}
